package org.bigtree.example.common.exception;

import lombok.Getter;
import org.bigtree.example.common.webapi.IResponseCode;

/**
 * @author bigTree
 * @since 2025/4/24
 */
@Getter
public abstract class BaseException extends RuntimeException {
    private final IResponseCode respCode;

    public BaseException(IResponseCode respCode) {
        this.respCode = respCode;
    }

    public BaseException(IResponseCode respCode, String format, Object... args) {
        super(String.format(format, args));
        this.respCode = respCode;
    }

    public String code() {
        return this.respCode.code();
    }

    public String desc() {
        return this.respCode.desc();
    }
}
